#include <iostream>
#include <string>
#include "CFile.h"

using namespace std;

int main(int argc, char *argv[])
{
	CFile file;

	ifstream input(argv[1]);
	string buf((istreambuf_iterator<char>(input)),istreambuf_iterator<char>());

	cout << "[recognize type]" << file.recognize(buf.c_str()) << endl;

	if(file.executable(argv[1])) {
		cout << "[executable]" << file.magic(argv[1]) << endl;
	}
	else {
		cout << "[not executable]" << file.magic(argv[1]) << endl;
	}

	cout << "change file permission to 0777" << endl;
	file.change_mode(argv[1], 0777);

	cout << "file type check" << endl;
	if(file.file_type("hahahaha")) cout << "no file : hahahaha" << endl;
	cout << "file type of " << argv[0] << " is " << file.file_type(argv[0]) << endl;

	cout << "separate \"" << argv[1] << "\" to path and file" << endl;
	string full_path = argv[1]; 
	string path = "";
	string only_file = "";

	file.separate_path_and_file(full_path, path, only_file);

	cout << "path = " << path << endl;
	cout << "file = " << only_file << endl;
}
